
getCookie=function(name){
    var arr=document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
    if(arr!=null)return unescape(arr[2]); return "";
}
var token= getCookie("token");
$(function(){
    //	获取个人资料
    $.ajax({
        url:'http://ww.yc630.com/api/index.php/Buyer/User/userinfo',
        type:"post",
        data:{
            'token':token
        },
        dataType:"JSON",
        success:function(data){
            $('#name').val(data['data']['nickname']);
            $("#gr_name").html(data['data']['nickname'])
            if(data['data']['sex'] == 1){
                $('#nan').attr('checked', 'checked');
            }else if(data['data']['sex'] == 2){
                $('#nv').attr('checked', 'checked');
            }
            $('#phone').html(data['data']['username']);
            $('#email').html(data['data']['email']);
            var avatar = data['data']['avatar'];
            if(avatar==''){
                avatar = '../img/Group%2019.png';
            }
            $('.grzl_wrap .photo img').attr('src',avatar);
            $("#gr_img").attr('src',avatar)
            $("#headPic").attr('src',avatar)
        }
    })
    //左侧菜单悬停
    $(".list_menu li").hover(function(){
        var index=$(this).index()
        if(index==0||index==5||index==9){
            $(this).css('backgroundColor','#ffffff')
        }
        else {
            $(this).css('backgroundColor','#FEE631')
        }
    },function(){
        var index=$(this).index()
        if(index==1){
            $(this).css('backgroundColor','#FEE631')
        }
        else{
            $(this).css('backgroundColor','#ffffff')
        }
    })
//       点击订单状态事件
    $("#state li").click(function(){
        $(this).addClass('state_sty').siblings().removeClass('state_sty')
    })
    var pagelimit = 20;
    function pages(count, limit){
        var page = 0;
        if(count>0){

            var page = Math.ceil(count/limit);

            var pagetag = "";
            for (var k=1;k<=page;k++) {
                if(k==1){
                    pagetag += '<li><a href="#" style="background:#ccc">'+k+'</a></li>';
                }else{
                    pagetag += '<li><a href="#" >'+k+'</a></li>';
                }
            }
            $('.pagination').html(pagetag);
        }
    }
//    获取订单列表
    $.ajax({
        url: "http://ww.yc630.com/api/index.php/Buyer/Order/orderList",
        type: "post",
        data:{'page':1,"pagelimit":pagelimit,"token":token},
        dataType: "json",
        success: function(data){
            pages(data['data']['count'],pagelimit);
            var str=""
            var st=""
            for(var i in data['data']['list']){
                var statusname=""
                var bq=""
                var sta=data['data']['list'][i]['status']
                if(sta==0){
                    statusname='待付款'
                    bq='<a>立即付款</a><a>取消订单</a><a>查看订单</a>'
                }
                if(sta==1){
                    statusname='待发货'
                    bq='<a>查看订单</a><a>取消订单</a>'
                }
                if(sta==2){
                    statusname='已发货'
                    bq='<a>确认收货</a><a>申请退货</a><a>查看订单</a>'
                }
                if(sta==3){
                    statusname='已关闭'
                    bq='<a>删除</a>'
                }
                if(sta==4){
                    statusname='待评价'
                    bq='<a>评价</a><a>退货</a><a>查看</a>'
                }
                if(sta==5){
                    statusname='已评价'
                    bq='<a>评价</a><a>退货</a><a>查看</a>'
                }
                if(sta==6){
                    statusname='申请退货'
                }
                if(sta==7){
                    statusname='拒绝退货'
                }
                if(sta==8){
                    statusname='待退货'
                }
                if(sta==9){
                    statusname='等待退货'
                }
                if(sta==10){
                    statusname='已退货'
                }
                if(sta==11){
                    statusname='等待退款'
                }
                if(sta==12){
                    statusname='拒绝退款'
                }
                if(sta==13){
                    statusname='退款成功'
                }
                if(sta==14){
                    statusname='平台仲裁'
                }
                if(sta==15){
                    statusname='删除订单'
                }
                 str+='<table border="0" cellspacing="0" cellpadding="0"  width="100%">'+
                    '<tr class="ddh">'+
                    '<td colspan="4"><span style="padding-left: 10px"></span><span>订单号:<span>'+data['data']['list'][i]['goods'][0]['orderid']+'</span></span></td>'+
                '<td colspan="2" style="text-align: right;">下单时间:<span>'+data['data']['list'][i]['goods'][0]['createtime']+'</span><span style="padding-right: 10px"></span></td>'+
                    '</tr>'
                         for(var j in data['data']['list'][i]['goods']) {
                         	var l = data['data']['list'][i]['goods'].length;
                            str+= '<tr class="spxq">'+
                             '<td class="spmz">'+
                             '<img src="'+data['data']['list'][i]['goods'][j]['goods_image']+'">' +
                             '<p>'+data['data']['list'][i]['goods'][j]['goods_name']+'</p>' +
                             '</td>' +
                             '<td class="price">￥<span>'+data['data']['list'][i]['goods'][0]['goods_price']+'</span></td>' +
                             '<td class="num">'+data['data']['list'][i]['goods'][j]['goods_nu']+'</td>';
                             if(j==0){
                             	 str += '<td class="total" rowspan="'+l+'"> <span>'+data['data']['list'][i]['total_money']+'</span> <p>(含快递费：0元)</p> </td> <td class="pay_state" rowspan="'+l+'">'+statusname+'</td>' +'<td class="cz" rowspan="'+l+'">'+bq+'</td>' +'</tr>'
                             }
                         }
                   str+= '</table>'
            }
            $(".ddxx").html(str)
        }
    })
//    点击状态
//    待支付
    $("#dzf").click(function(){
        $.ajax({
            url: "http://ww.yc630.com/api/index.php/Buyer/Order/orderList",
            type: "post",
            data:{
                status:"0",'page':1,"pagelimit":pagelimit,"token":token
            },
            dataType: "json",
            success: function(data){
                pages(data['data']['count'],pagelimit);
                var str=""
                var st=""
                for(var i in data['data']['list']){
                    var statusname=""
                    var bq=""
                    var sta=data['data']['list'][i]['status']
                    if(sta==0){
                        statusname='待付款'
                        bq='<a>立即付款</a><a>取消订单</a><a>查看订单</a>'
                    }
                    if(sta==1){
                        statusname='待发货'
                        bq='<a>查看订单</a><a>取消订单</a>'
                    }
                    if(sta==2){
                        statusname='已发货'
                        bq='<a>确认收货</a><a>申请退货</a><a>查看订单</a>'
                    }
                    if(sta==3){
                        statusname='已关闭'
                        bq='<a>删除</a>'
                    }
                    if(sta==4){
                        statusname='待评价'
                        bq='<a>评价</a><a>退货</a><a>查看</a>'
                    }
                    if(sta==5){
                        statusname='已评价'
                        bq='<a>评价</a><a>退货</a><a>查看</a>'
                    }
                    if(sta==6){
                        statusname='申请退货'
                    }
                    if(sta==7){
                        statusname='拒绝退货'
                    }
                    if(sta==8){
                        statusname='待退货'
                    }
                    if(sta==9){
                        statusname='等待退货'
                    }
                    if(sta==10){
                        statusname='已退货'
                    }
                    if(sta==11){
                        statusname='等待退款'
                    }
                    if(sta==12){
                        statusname='拒绝退款'
                    }
                    if(sta==13){
                        statusname='退款成功'
                    }
                    if(sta==14){
                        statusname='平台仲裁'
                    }
                    if(sta==15){
                        statusname='删除订单'
                    }
                    str+='<table cellspacing="0" cellpadding="0" border="0"  width="100%">'+
                        '<tr class="ddh">'+
                        '<td colspan="4"><span style="padding-left: 10px"></span><span>订单号:<span>'+data['data']['list'][i]['goods'][0]['orderid']+'</span></span></td>'+
                        '<td colspan="2" style="text-align: right;">下单时间:<span>'+data['data']['list'][i]['goods'][0]['createtime']+'</span><span style="padding-right: 10px"></span></td>'+
                        '</tr>'
                    for(var j in data['data']['list'][i]['goods']) {
                        var l = data['data']['list'][i]['goods'].length;
                        str+= '<tr class="spxq">'+
                            '<td class="spmz">'+
                            '<img src="'+data['data']['list'][i]['goods'][j]['goods_image']+'">' +
                            '<p>'+data['data']['list'][i]['goods'][j]['goods_name']+'</p>' +
                            '</td>' +
                            '<td class="price">￥<span>'+data['data']['list'][i]['goods'][0]['goods_price']+'</span></td>' +
                            '<td class="num">'+data['data']['list'][i]['goods'][j]['goods_nu']+'</td>';
                        if(j==0){
                            str += '<td class="total" rowspan="'+l+'"> <span>'+data['data']['list'][i]['total_money']+'</span> <p>(含快递费：0元)</p> </td> <td class="pay_state" rowspan="'+l+'">'+statusname+'</td>' +'<td class="cz" rowspan="'+l+'">'+bq+'</td>' +'</tr>'
                        }
                    }
                    str+= '</table>'
                }
                $(".ddxx").html(str)
            },
            error:function(data){
                console.log(data)
            }
        })
    })
    //    全部订单
    $("#qbdd").click(function(){
        $.ajax({
            url: "http://ww.yc630.com/api/index.php/Buyer/Order/orderList",
            type: "post",
            data:{
                status:"",'page':1,"pagelimit":pagelimit,"token":token
            },
            dataType: "json",
            success: function(data){
                pages(data['data']['count'],pagelimit);
                var str=""
                var st=""
                for(var i in data['data']['list']){
                    var statusname=""
                    var sta=data['data']['list'][i]['status']
                    if(sta==0){
                        statusname='待付款'
                        bq='<a>立即付款</a><a>取消订单</a><a>查看订单</a>'
                    }
                    if(sta==1){
                        statusname='待发货'
                        bq='<a>查看订单</a><a>取消订单</a>'
                    }
                    if(sta==2){
                        statusname='已发货'
                        bq='<a>确认收货</a><a>申请退货</a><a>查看订单</a>'
                    }
                    if(sta==3){
                        statusname='已关闭'
                        bq='<a>删除</a>'
                    }
                    if(sta==4){
                        statusname='待评价'
                        bq='<a>评价</a><a>退货</a><a>查看</a>'
                    }
                    if(sta==5){
                        statusname='已评价'
                        bq='<a>评价</a><a>退货</a><a>查看</a>'
                    }
                    if(sta==6){
                        statusname='申请退货'
                    }
                    if(sta==7){
                        statusname='拒绝退货'
                    }
                    if(sta==8){
                        statusname='待退货'
                    }
                    if(sta==9){
                        statusname='等待退货'
                    }
                    if(sta==10){
                        statusname='已退货'
                    }
                    if(sta==11){
                        statusname='等待退款'
                    }
                    if(sta==12){
                        statusname='拒绝退款'
                    }
                    if(sta==13){
                        statusname='退款成功'
                    }
                    if(sta==14){
                        statusname='平台仲裁'
                    }
                    if(sta==15){
                        statusname='删除订单'
                    }
                    str+='<table cellspacing="0" cellpadding="0" border="0"  width="100%">'+
                        '<tr class="ddh">'+
                        '<td colspan="4"><span style="padding-left: 10px"></span><span>订单号:<span>'+data['data']['list'][i]['goods'][0]['orderid']+'</span></span></td>'+
                        '<td colspan="2" style="text-align: right;">下单时间:<span>'+data['data']['list'][i]['goods'][0]['createtime']+'</span><span style="padding-right: 10px"></span></td>'+
                        '</tr>'
                    for(var j in data['data']['list'][i]['goods']) {
                        var l = data['data']['list'][i]['goods'].length;
                        str+= '<tr class="spxq">'+
                            '<td class="spmz">'+
                            '<img src="'+data['data']['list'][i]['goods'][j]['goods_image']+'">' +
                            '<p>'+data['data']['list'][i]['goods'][j]['goods_name']+'</p>' +
                            '</td>' +
                            '<td class="price">￥<span>'+data['data']['list'][i]['goods'][0]['goods_price']+'</span></td>' +
                            '<td class="num">'+data['data']['list'][i]['goods'][j]['goods_nu']+'</td>';
                        if(j==0){
                            str += '<td class="total" rowspan="'+l+'"> <span>'+data['data']['list'][i]['total_money']+'</span> <p>(含快递费：0元)</p> </td> <td class="pay_state" rowspan="'+l+'">'+statusname+'</td>' +'<td class="cz" rowspan="'+l+'">'+bq+'</td>' +'</tr>'
                        }
                    }
                    str+= '</table>'
                }
                $(".ddxx").html(str)
            }
        })
    })
    //    待收货
    $("#dsh").click(function(){
        $.ajax({
            url: "http://ww.yc630.com/api/index.php/Buyer/Order/orderList",
            type: "post",
            data:{
                status:"2",'page':1,"pagelimit":pagelimit,"token":token
            },
            dataType: "json",
            success: function(data){
                var str=""
                var st=""
                for(var i in data['data']['list']){
                    var statusname=""
                    var sta=data['data']['list'][i]['status']
                    if(sta==0){
                        statusname='待付款'
                        bq='<a>立即付款</a><a>取消订单</a><a>查看订单</a>'
                    }
                    if(sta==1){
                        statusname='待发货'
                        bq='<a>查看订单</a><a>取消订单</a>'
                    }
                    if(sta==2){
                        statusname='已发货'
                        bq='<a>确认收货</a><a>申请退货</a><a>查看订单</a>'
                    }
                    if(sta==3){
                        statusname='已关闭'
                        bq='<a>删除</a>'
                    }
                    if(sta==4){
                        statusname='待评价'
                        bq='<a>评价</a><a>退货</a><a>查看</a>'
                    }
                    if(sta==5){
                        statusname='已评价'
                        bq='<a>评价</a><a>退货</a><a>查看</a>'
                    }
                    if(sta==6){
                        statusname='申请退货'
                    }
                    if(sta==7){
                        statusname='拒绝退货'
                    }
                    if(sta==8){
                        statusname='待退货'
                    }
                    if(sta==9){
                        statusname='等待退货'
                    }
                    if(sta==10){
                        statusname='已退货'
                    }
                    if(sta==11){
                        statusname='等待退款'
                    }
                    if(sta==12){
                        statusname='拒绝退款'
                    }
                    if(sta==13){
                        statusname='退款成功'
                    }
                    if(sta==14){
                        statusname='平台仲裁'
                    }
                    if(sta==15){
                        statusname='删除订单'
                    }
                    str+='<table cellspacing="0" cellpadding="0" border="0"  width="100%">'+
                        '<tr class="ddh">'+
                        '<td colspan="4"><span style="padding-left: 10px"></span><span>订单号:<span>'+data['data']['list'][i]['goods'][0]['orderid']+'</span></span></td>'+
                        '<td colspan="2" style="text-align: right;">下单时间:<span>'+data['data']['list'][i]['goods'][0]['createtime']+'</span><span style="padding-right: 10px"></span></td>'+
                        '</tr>'
                    for(var j in data['data']['list'][i]['goods']) {
                        var l = data['data']['list'][i]['goods'].length;
                        str+= '<tr class="spxq">'+
                            '<td class="spmz">'+
                            '<img src="'+data['data']['list'][i]['goods'][j]['goods_image']+'">' +
                            '<p>'+data['data']['list'][i]['goods'][j]['goods_name']+'</p>' +
                            '</td>' +
                            '<td class="price">￥<span>'+data['data']['list'][i]['goods'][0]['goods_price']+'</span></td>' +
                            '<td class="num">'+data['data']['list'][i]['goods'][j]['goods_nu']+'</td>';
                        if(j==0){
                            str += '<td class="total" rowspan="'+l+'"> <span>'+data['data']['list'][i]['total_money']+'</span> <p>(含快递费：0元)</p> </td> <td class="pay_state" rowspan="'+l+'">'+statusname+'</td>' +'<td class="cz" rowspan="'+l+'">'+bq+'</td>' +'</tr>'
                        }
                    }
                    str+= '</table>'
                }
                $(".ddxx").html(str)
            }
        })
    })
    //    待评价
    $("#dpj").click(function(){
        $.ajax({
            url: "http://ww.yc630.com/api/index.php/Buyer/Order/orderList",
            type: "post",
            data:{
                status:"4",'page':1,"pagelimit":pagelimit,"token":token
            },
            dataType: "json",
            success: function(data){
                var str=""
                var st=""
                for(var i in data['data']['list']){
                    var statusname=""
                    var sta=data['data']['list'][i]['status']
                    if(sta==0){
                        statusname='待付款'
                        bq='<a>立即付款</a><a>取消订单</a><a>查看订单</a>'
                    }
                    if(sta==1){
                        statusname='待发货'
                        bq='<a>查看订单</a><a>取消订单</a>'
                    }
                    if(sta==2){
                        statusname='已发货'
                        bq='<a>确认收货</a><a>申请退货</a><a>查看订单</a>'
                    }
                    if(sta==3){
                        statusname='已关闭'
                        bq='<a>删除</a>'
                    }
                    if(sta==4){
                        statusname='待评价'
                        bq='<a>评价</a><a>退货</a><a>查看</a>'
                    }
                    if(sta==5){
                        statusname='已评价'
                        bq='<a>评价</a><a>退货</a><a>查看</a>'
                    }
                    if(sta==6){
                        statusname='申请退货'
                    }
                    if(sta==7){
                        statusname='拒绝退货'
                    }
                    if(sta==8){
                        statusname='待退货'
                    }
                    if(sta==9){
                        statusname='等待退货'
                    }
                    if(sta==10){
                        statusname='已退货'
                    }
                    if(sta==11){
                        statusname='等待退款'
                    }
                    if(sta==12){
                        statusname='拒绝退款'
                    }
                    if(sta==13){
                        statusname='退款成功'
                    }
                    if(sta==14){
                        statusname='平台仲裁'
                    }
                    if(sta==15){
                        statusname='删除订单'
                    }
                    str+='<table cellspacing="0" cellpadding="0" border="0"  width="100%">'+
                        '<tr class="ddh">'+
                        '<td colspan="4"><span style="padding-left: 10px"></span><span>订单号:<span>'+data['data']['list'][i]['goods'][0]['orderid']+'</span></span></td>'+
                        '<td colspan="2" style="text-align: right;">下单时间:<span>'+data['data']['list'][i]['goods'][0]['createtime']+'</span><span style="padding-right: 10px"></span></td>'+
                        '</tr>'
                    for(var j in data['data']['list'][i]['goods']) {
                        var l = data['data']['list'][i]['goods'].length;
                        str+= '<tr class="spxq">'+
                            '<td class="spmz">'+
                            '<img src="'+data['data']['list'][i]['goods'][j]['goods_image']+'">' +
                            '<p>'+data['data']['list'][i]['goods'][j]['goods_name']+'</p>' +
                            '</td>' +
                            '<td class="price">￥<span>'+data['data']['list'][i]['goods'][0]['goods_price']+'</span></td>' +
                            '<td class="num">'+data['data']['list'][i]['goods'][j]['goods_nu']+'</td>';
                        if(j==0){
                            str += '<td class="total" rowspan="'+l+'"> <span>'+data['data']['list'][i]['total_money']+'</span> <p>(含快递费：0元)</p> </td> <td class="pay_state" rowspan="'+l+'">'+statusname+'</td>' +'<td class="cz" rowspan="'+l+'">'+bq+'</td>' +'</tr>'
                        }
                    }
                    str+= '</table>'
                }
                $(".ddxx").html(str)
            },
            error:function(){
                $(".ddxx").html("")
            }
        })
    })
    //    售后
    $("#sh").click(function(){
        $.ajax({
            url: "http://ww.yc630.com/api/index.php/Buyer/Order/orderList",
            type: "post",
            data:{
                status:"6,7,8,9,10,11,12,13,14,15,16",'page':1,"pagelimit":pagelimit,"token":token
            },
            dataType: "json",
            success: function(data){
                var str=""
                var st=""
                for(var i in data['data']['list']){
                    var statusname=""
                    var sta=data['data']['list'][i]['status']
                    if(sta==0){
                        statusname='待付款'
                    }
                    if(sta==1){
                        statusname='待发货'
                    }
                    if(sta==2){
                        statusname='已发货'
                    }
                    if(sta==3){
                        statusname='已关闭'
                    }
                    if(sta==4){
                        statusname='待评价'
                    }
                    if(sta==5){
                        statusname='已评价'
                    }
                    if(sta==6){
                        statusname='申请退货'
                    }
                    if(sta==7){
                        statusname='拒绝退货'
                    }
                    if(sta==8){
                        statusname='待退货'
                    }
                    if(sta==9){
                        statusname='等待退货'
                    }
                    if(sta==10){
                        statusname='已退货'
                    }
                    if(sta==11){
                        statusname='等待退款'
                    }
                    if(sta==12){
                        statusname='拒绝退款'
                    }
                    if(sta==13){
                        statusname='退款成功'
                    }
                    if(sta==14){
                        statusname='平台仲裁'
                    }
                    if(sta==15){
                        statusname='删除订单'
                    }
                    str+='<table cellspacing="0" cellpadding="0" border="0"  width="100%">'+
                        '<tr class="ddh">'+
                        '<td colspan="4"><span style="padding-left: 10px"></span><span>订单号:<span>'+data['data']['list'][i]['goods'][0]['orderid']+'</span></span></td>'+
                        '<td colspan="2" style="text-align: right;">下单时间:<span>'+data['data']['list'][i]['goods'][0]['createtime']+'</span><span style="padding-right: 10px"></span></td>'+
                        '</tr>'
                    for(var j in data['data']['list'][i]['goods']) {
                        var l = data['data']['list'][i]['goods'].length;
                        str+= '<tr class="spxq">'+
                            '<td class="spmz">'+
                            '<img src="'+data['data']['list'][i]['goods'][j]['goods_image']+'">' +
                            '<p>'+data['data']['list'][i]['goods'][j]['goods_name']+'</p>' +
                            '</td>' +
                            '<td class="price">￥<span>'+data['data']['list'][i]['goods'][0]['goods_price']+'</span></td>' +
                            '<td class="num">'+data['data']['list'][i]['goods'][j]['goods_nu']+'</td>';
                        if(j==0){
                            str += '<td class="total" rowspan="'+l+'"> <span>'+data['data']['list'][i]['total_money']+'</span> <p>(含快递费：0元)</p> </td> <td class="pay_state" rowspan="'+l+'">'+statusname+'</td>' +'<td class="cz" rowspan="'+l+'">'+bq+'</td>' +'</tr>'
                        }
                    }
                    str+= '</table>'
                }
                $(".ddxx").html(str)
            },
            error:function(){
                $(".ddxx").html("")
            }
        })
    })
    //    已取消
    $("#yqx").click(function(){
        $.ajax({
            url: "http://ww.yc630.com/api/index.php/Buyer/Order/orderList",
            type: "post",
            data:{
                status:"3",'page':1,"pagelimit":pagelimit,"token":token
            },
            dataType: "json",
            success: function(data){
                var str=""
                var st=""
                for(var i in data['data']['list']){
                    var statusname=""
                    var sta=data['data']['list'][i]['status']
                    if(sta==0){
                        statusname='待付款'
                        bq='<a>立即付款</a><a>取消订单</a><a>查看订单</a>'
                    }
                    if(sta==1){
                        statusname='待发货'
                        bq='<a>查看订单</a><a>取消订单</a>'
                    }
                    if(sta==2){
                        statusname='已发货'
                        bq='<a>确认收货</a><a>申请退货</a><a>查看订单</a>'
                    }
                    if(sta==3){
                        statusname='已关闭'
                        bq='<a>删除</a>'
                    }
                    if(sta==4){
                        statusname='待评价'
                        bq='<a>评价</a><a>退货</a><a>查看</a>'
                    }
                    if(sta==5){
                        statusname='已评价'
                        bq='<a>评价</a><a>退货</a><a>查看</a>'
                    }
                    if(sta==6){
                        statusname='申请退货'
                    }
                    if(sta==7){
                        statusname='拒绝退货'
                    }
                    if(sta==8){
                        statusname='待退货'
                    }
                    if(sta==9){
                        statusname='等待退货'
                    }
                    if(sta==10){
                        statusname='已退货'
                    }
                    if(sta==11){
                        statusname='等待退款'
                    }
                    if(sta==12){
                        statusname='拒绝退款'
                    }
                    if(sta==13){
                        statusname='退款成功'
                    }
                    if(sta==14){
                        statusname='平台仲裁'
                    }
                    if(sta==15){
                        statusname='删除订单'
                    }
                    str+='<table cellspacing="0" cellpadding="0" border="0"  width="100%">'+
                        '<tr class="ddh">'+
                        '<td colspan="4"><span style="padding-left: 10px"></span><span>订单号:<span>'+data['data']['list'][i]['goods'][0]['orderid']+'</span></span></td>'+
                        '<td colspan="2" style="text-align: right;">下单时间:<span>'+data['data']['list'][i]['goods'][0]['createtime']+'</span><span style="padding-right: 10px"></span></td>'+
                        '</tr>'
                    for(var j in data['data']['list'][i]['goods']) {
                        var l = data['data']['list'][i]['goods'].length;
                        str+= '<tr class="spxq">'+
                            '<td class="spmz">'+
                            '<img src="'+data['data']['list'][i]['goods'][j]['goods_image']+'">' +
                            '<p>'+data['data']['list'][i]['goods'][j]['goods_name']+'</p>' +
                            '</td>' +
                            '<td class="price">￥<span>'+data['data']['list'][i]['goods'][0]['goods_price']+'</span></td>' +
                            '<td class="num">'+data['data']['list'][i]['goods'][j]['goods_nu']+'</td>';
                        if(j==0){
                            str += '<td class="total" rowspan="'+l+'"> <span>'+data['data']['list'][i]['total_money']+'</span> <p>(含快递费：0元)</p> </td> <td class="pay_state" rowspan="'+l+'">'+statusname+'</td>' +'<td class="cz" rowspan="'+l+'">'+bq+'</td>' +'</tr>'
                        }
                    }
                    str+= '</table>'
                }
                $(".ddxx").html(str)
            },
            error:function(){
                $(".ddxx").html("")
            }
        })
    })
    //    分页点击
    $('.pagination').on('click','li a',function(){
        //获取当前页码
        var pagenum = $(this).html();
        //改变背景颜色
        $(this).css('background','#ccc');
        $(this).parents('li').siblings('li').find('a').css('background','#FFF')
        var datas = {};
        datas['page']=pagenum;
        datas['pagelimit']=pagelimit;
        datas['token']=token;
        $.ajax({
            url: "http://ww.yc630.com/api/index.php/Buyer/Order/orderList",
            type: "post",
            data:datas,
            dataType: "json",
            success: function(data){
                var str=""
                var st=""
                for(var i in data['data']['list']){
                    var statusname=""
                    var bq=""
                    var sta=data['data']['list'][i]['status']
                    if(sta==0){
                        statusname='待付款'
                        bq='<a>立即付款</a><a>取消订单</a><a>查看订单</a>'
                    }
                    if(sta==1){
                        statusname='待发货'
                        bq='<a>查看订单</a><a>取消订单</a>'
                    }
                    if(sta==2){
                        statusname='已发货'
                        bq='<a>确认收货</a><a>申请退货</a><a>查看订单</a>'
                    }
                    if(sta==3){
                        statusname='已关闭'
                        bq='<a>删除</a>'
                    }
                    if(sta==4){
                        statusname='待评价'
                        bq='<a>评价</a><a>退货</a><a>查看</a>'
                    }
                    if(sta==5){
                        statusname='已评价'
                        bq='<a>评价</a><a>退货</a><a>查看</a>'
                    }
                    if(sta==6){
                        statusname='申请退货'
                    }
                    if(sta==7){
                        statusname='拒绝退货'
                    }
                    if(sta==8){
                        statusname='待退货'
                    }
                    if(sta==9){
                        statusname='等待退货'
                    }
                    if(sta==10){
                        statusname='已退货'
                    }
                    if(sta==11){
                        statusname='等待退款'
                    }
                    if(sta==12){
                        statusname='拒绝退款'
                    }
                    if(sta==13){
                        statusname='退款成功'
                    }
                    if(sta==14){
                        statusname='平台仲裁'
                    }
                    if(sta==15){
                        statusname='删除订单'
                    }
                    str+='<table cellspacing="0" cellpadding="0" border="0"  width="100%">'+
                        '<tr class="ddh">'+
                        '<td colspan="4"><span style="padding-left: 10px"></span><span>订单号:<span>'+data['data']['list'][i]['goods'][0]['orderid']+'</span></span></td>'+
                        '<td colspan="2" style="text-align: right;">下单时间:<span>'+data['data']['list'][i]['goods'][0]['createtime']+'</span><span style="padding-right: 10px"></span></td>'+
                        '</tr>'
                    for(var j in data['data']['list'][i]['goods']) {
                        var l = data['data']['list'][i]['goods'].length;
                        str+= '<tr class="spxq">'+
                            '<td class="spmz">'+
                            '<img src="'+data['data']['list'][i]['goods'][j]['goods_image']+'">' +
                            '<p>'+data['data']['list'][i]['goods'][j]['goods_name']+'</p>' +
                            '</td>' +
                            '<td class="price">￥<span>'+data['data']['list'][i]['goods'][0]['goods_price']+'</span></td>' +
                            '<td class="num">'+data['data']['list'][i]['goods'][j]['goods_nu']+'</td>';
                        if(j==0){
                            str += '<td class="total" rowspan="'+l+'"> <span>'+data['data']['list'][i]['total_money']+'</span> <p>(含快递费：0元)</p> </td> <td class="pay_state" rowspan="'+l+'">'+statusname+'</td>' +'<td class="cz" rowspan="'+l+'">'+bq+'</td>' +'</tr>'
                        }
                    }
                    str+= '</table>'
                }
                $(".ddxx").html(str)
            }
        })
    })
})